/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "habitat")
@NamedQueries({
    @NamedQuery(name = "Habitat.findAll", query = "SELECT h FROM Habitat h"),
    @NamedQuery(name = "Habitat.findByIdhabitat", query = "SELECT h FROM Habitat h WHERE h.idhabitat = :idhabitat"),
    @NamedQuery(name = "Habitat.findByHabitat", query = "SELECT h FROM Habitat h WHERE h.habitat = :habitat")})
public class Habitat implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idhabitat")
    private Integer idhabitat;
    @Column(name = "habitat")
    private String habitat;
    @OneToMany(mappedBy = "habitat", fetch = FetchType.LAZY)
    private List<Eventelement> eventelementList;
    @OneToMany(mappedBy = "habitat", fetch = FetchType.LAZY)
    private List<Localityelement> localityelementList;

    public Habitat() {
    }

    public Habitat(Integer idhabitat) {
        this.idhabitat = idhabitat;
    }

    public Habitat(Integer idhabitat, String habitat) {
        this.idhabitat = idhabitat;
        this.habitat = habitat;
    }

    public Integer getIdhabitat() {
        return idhabitat;
    }

    public void setIdhabitat(Integer idhabitat) {
        this.idhabitat = idhabitat;
    }

    public String getHabitat() {
        return habitat;
    }

    public void setHabitat(String habitat) {
        this.habitat = habitat;
    }

    public List<Eventelement> getEventelementList() {
        return eventelementList;
    }

    public void setEventelementList(List<Eventelement> eventelementList) {
        this.eventelementList = eventelementList;
    }

    public List<Localityelement> getLocalityelementList() {
        return localityelementList;
    }

    public void setLocalityelementList(List<Localityelement> localityelementList) {
        this.localityelementList = localityelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idhabitat != null ? idhabitat.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Habitat)) {
            return false;
        }
        Habitat other = (Habitat) object;
        if ((this.idhabitat == null && other.idhabitat != null) || (this.idhabitat != null && !this.idhabitat.equals(other.idhabitat))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Habitat[idhabitat=" + idhabitat + "]";
    }

}
